import aca.Administrador
import aca.Aluno
import aca.Dominio
import aca.Professor
import aca.Turma
import aca.Atividade
import aca.Criterio
import aca.Solicitacao

class BootStrap {

    def init = { servletContext ->
		// Check whether the test data already exists.
		if (!Professor.count()) {
			new Professor(id: 1, nome: "Kyller", email: "kyller@dsc.ufcg.edu.br").save(failOnError: true)
			new Professor(id: 2, nome: "Thiago", email: "thiago@dsc.ufcg.edu.br").save(failOnError: true)
	//		new Professor(id: 3, nome: "Anderson", email: "anderson.ccomp@gmail.com").save(failOnError: true)
		}
		
		if (!Turma.count()){
			new Turma(id: 1, nome: "Turma 1", professor: Professor.get(1), disciplina: "lp2", periodo: "2012.2").save(failOnError: true);
			new Turma(id: 2, nome: "Turma 2", professor: Professor.get(2), disciplina: "lp2", periodo: "2012.2").save(failOnError: true);
		}
//		if (!Atividade.count()){
//			new Atividade(id:1, nome:"Lab 1", descricao: "Descricao lab 1", deadline: "10/10/2013", turma: Turma.get(1)).save(failOnError: true)
//		}
		if (!Aluno.count()){
			new Aluno(id:1, nome:"Maria Silva", email:"maria.silva@ccc.ufcg.edu.br").save(failOnError:true)
			new Aluno(id:2, nome:"Joao Souza", email:"joao.souza@ccc.ufcg.edu.br").save(failOnError:true)
			new Aluno(id:3, nome:"Ana Pereira", email:"ana.pereira@ccc.ufcg.edu.br").save(failOnError:true)
		}
		if (!Administrador.count()){
		//	new Administrador(id:1, nome: "Anderson", email: "anderson.firmino@ccc.ufcg.edu.br").save(failOnError: true)
		}
		if (!Dominio.count()){
			new Dominio(id:1, dominio: "ccc.ufcg.edu.br").save(failOnError: true)
			new Dominio(id:2, dominio: "gmail.com").save(failOnError: true)
		}
	}
	
	
    def destroy = {
    }
	
	
}
